<template>
  <div class="detail-container">
    <div class="top-wrapper">
      <div class="org-detail">
        <div class="org-info">
          <div class="i-top">
            <div class="t-left">
              <span class="title">{{detail.csName}}</span>
              <el-tag class="tagItem" size="small" type="primary">{{detail.typeSecond}}</el-tag>
            </div>
            <div class="t-right">
              <!-- <el-tag class="tagItem" size="small" type="danger">存在风险场所</el-tag> -->
              <el-tag class="tagItem" size="small" type="success">启用中  NO:{{detail.id}}</el-tag>
            </div>
          </div>
          <div class="info-detail label-color">
            <div>场所地址：{{detail.fullAddress}}</div>
            <div>所属机构：{{detail.orgName}}</div>
            <div>统一社会信用代码：{{detail.unifiedCode}}</div>
          </div>
          <div class="info-detail label-color">
            <div>是否需要健康申报：{{detail.reportCheckNeed}}</div>
            <div>是否需要反馈提示音：--</div>
          </div>
          <div class="p-info">
            <div><i class="el-icon-user-solid"></i>场所码申领人：{{detail.applicantName}}</div>
            <div>联系电话：{{detail.applicantPhone}}</div>
            <div>身份证号：{{detail.applicantIdCard}}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom-wrapper">
      <div class="tabs-wrapper">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="场所码" name="csm">
            <CsmMap 
              ref="map"
            />
            <el-skeleton :loading="detailLoading" :rows="6" animated />
          </el-tab-pane>
          <!-- <el-tab-pane label="场所码统计" name="sta">
            <CsmStatistics />
          </el-tab-pane> -->
          <!-- <el-tab-pane label="场所管理人员" name="manager">
            <CsmManager />
          </el-tab-pane> -->
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import { getCsInfoDetail } from '@/http/apiUrls.js';
import CsmMap from '@/components/csmCom/csmManage/CsmMap.vue';
import CsmStatistics from '@/components/csmCom/csmManage/CsmStatistics.vue';
import CsmManager from '@/components/csmCom/csmManage/CsmManager.vue';
export default {
  name: 'CSMManageDetail',
  components: {CsmMap, CsmStatistics, CsmManager},
  data() {
    return {
      detail: {
        id: 0,
        csName: '', // 场所名
        typeSecond: '', // 场所类别
        fullAddress: '',
        orgName: '',
        unifiedCode: '',
        reportCheckNeed: '',
        applicantName: '',
        applicantIdCard: '',
        applicantPhone: ''
      },
      activeName: 'csm',
      detailLoading: true
    }
  },
  mounted(){
    const id = this.$route.query.id
    this.getDetailData(id)
  },
  methods:{
    handleClick(tab, event) {
      console.log(tab, event);
    },
    getDetailData(id){
      let url = getCsInfoDetail+id
      this.$getJson(url).then(res => {
        if(res){
          this.detail = res;
          this.$refs.map.setDetail(this.detail)
          this.detailLoading = false
        }
      })
    }
  }
}
</script>
<style>
  .el-tabs__item{
    color: rgb(127, 127, 127);
  }
</style>
<style lang="scss" scoped>
.detail-container{
  margin: 10px;
}
.top-wrapper{
  background: #fff;
  padding: 20px;

  .org-detail{
    display:flex;
    display: -webkit-flex;
  }
}

.org-info{
  flex: 1;
  margin-left: 1rem;
  
  .i-top{
    display: flex;
    display: -webkit-flex;
    justify-content: space-between;

    .title{
      font-weight: 700;
    }
    .tagItem{
      margin-left:1rem;
    }
  }
  .info-detail{
    font-size: 14px;
    display: flex;
    display: -webkit-flex;
    margin-top: 0.4rem;
    div:first-child{
      padding-right: 1rem;
    }
    div:not(:first-child){
      padding: 0 1rem;
      border-left: 1px solid #ced6e0;
    }
  }

  .p-info{
    font-size: 14px;
    display: flex;
    display: -webkit-flex;
    margin-top: 0.8rem;
    font-weight: 600;
    div:first-child{
      padding-right: 1.3rem;
    }
    div:not(:first-child){
      padding: 0 1.3rem;
    }
    i{
      color: #409eff;
      font-size: 18px;
      margin-right: 0.5rem;
    }
  }
}

.bottom-wrapper{
  margin-top: 1rem;
  background-color: #fff;
  padding: 1rem;

  .title{
    font-weight: 900;
    margin: 13px 0;
  }
}

.detail-info-wrapper{
  
  .info-title{
    font-size: 14px;
    display: flex;
    display: -webkit-flex;
    align-items: center;

    .title{
      font-size: 16px;
    }

    .tag{
      padding: 0 20px;

      .tagItem{
        margin: 0 10px;
      }
    }

    .time-box{
      flex: 1;
      text-align: right;
    }
  }

  .info-detail{
    padding: 10px 0;
    font-size: 12px;
    display: flex;
    display: -webkit-flex;
    flex-wrap: wrap;
    align-items: center;
    .col-item{
      display: flex;
      padding: 5px 0;
      div:first-child{
        width: 115px;
        text-align: right;
      }
    }

    .long-msg{
      width: 35%;
    }

    .short-msg{
      width: 15%;
    }
  }
}

  

</style>